package com.colorfruit.admin.business.dao;

import com.colorfruit.admin.pojo.entity.FoundationUserReceiveAddress;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface FoundationUserReceiveAddressMapper {
    int deleteByPrimaryKey(Long id);

    int insert(FoundationUserReceiveAddress record);

    int insertSelective(FoundationUserReceiveAddress record);

    FoundationUserReceiveAddress selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(FoundationUserReceiveAddress record);

    int updateByPrimaryKey(FoundationUserReceiveAddress record);

    /**
     * 获取该用户的地址列表
     * @param userId
     * @return
     */
    List<FoundationUserReceiveAddress> selectUserAddressList(String userId);

    /**
     * 变更地址状态
     * @param id
     * @param recordStatus
     * @return
     */
    Integer updateUserAddressStatus(@Param("id") Long id, @Param("recordStatus") Byte recordStatus);

    /**
     * 获取默认地址
     * @param userId
     * @return
     */
    FoundationUserReceiveAddress getDefaultAddress(@Param("userId")String userId);

    /**
     *
     * @param userId
     * @return
     */
    Integer updateAddressNotDefault(@Param("userId") String userId);

    /**
     *
     * @param id
     * @param id
     * @return
     */
    Integer setDefaultAddress(@Param("id")Long id);



    /**
     * 计算地址数量
     * @param userId
     * @return
     */
    Integer countAddressNum(@Param("userId")String userId);
}